package ru.papergames.battleserver.network.serverpackets.flashuser;

import ru.papergames.battleserver.model.battle.BattlePlayer;
import ru.papergames.common.netutils.ModelWriterUtils;

/**
 * @author atroshanin
 */
public class BattleMemberInfoAboutHimself extends PaperGameServerPacket {

    private final BattlePlayer battlePlayer;

    public BattleMemberInfoAboutHimself(BattlePlayer battlePlayer) {
        this.battlePlayer = battlePlayer;
    }

    @Override
    protected int getPacketId() {
        return BATTLE_MEMBER_INFO_ABOUT_HIMSELF_PACKET_ID;
    }

    @Override
    protected void writePacketData() {
        writeD(battlePlayer.getBattle().getBattleOrderId());
        writeC(battlePlayer.getTeamId());
        writeH(battlePlayer.getBallColor().getId());

        ModelWriterUtils.writePlayerToBuffer(_buf, battlePlayer.getGameUser().getPlayer());
    }

}
